<?php
	$assessment_breadcrum = $ajax->link(
		'Assessment',
		array( 'controller' => 'questiongroups', 'action' => 'ajax_get', $assessment['Assessment']['id'] ),
		array( 'update' => 'edit_div_'.$assessment['Assessment']['id'], 'indicator' => 'loading')
	);
	$questiongroup_breadcrum = $ajax->link(
		'Question Group',
		array( 'controller' => 'questiongroups', 'action' => 'ajax_edit', $questiongroup['Questiongroup']['id'] ),
		array( 'update' => 'edit_div_'.$assessment['Assessment']['id'], 'indicator' => 'loading')
	);
	
	$question_breadcrum = $ajax->link(
		'Questions',
		array( 'controller' => 'questions', 'action' => 'ajax_get', $questiongroup['Questiongroup']['id'] ),
		array( 'update' => 'edit_div_'.$assessment['Assessment']['id'], 'indicator' => 'loading')
	);
	
	$questionedit_breadcrum = $ajax->link(
		'Question',
		array( 'controller' => 'questions', 'action' => 'ajax_edit', $question['Question']['id'] ),
		array( 'update' => 'edit_div_'.$assessment['Assessment']['id'], 'indicator' => 'loading')
	);
	
	$answerList_breadcrum = $ajax->link(
		'Answers',
		array( 'controller' => 'answers', 'action' => 'ajax_get', $question['Question']['id'] ),
		array( 'update' => 'edit_div_'.$assessment['Assessment']['id'], 'indicator' => 'loading')
	);

?>
<div id="whiteBG">
<div id="crumb"><ul>
	<li class="crumbMiddle" id="crumb01"><?php echo $assessment_breadcrum;?></li>
	<li class="crumbMiddle" id="crumb02"><?php echo $questiongroup_breadcrum;?></li>
	<li class="crumbMiddle" id="crumb03"><?php echo $question_breadcrum;?></li>
	<li class="crumbMiddle" id="crumb04"><?php echo $questionedit_breadcrum;?></li>
	<li class="crumbMiddle" id="crumb05mid"><?php echo $answerList_breadcrum;?></li>
	<li class="crumbMiddle" id="crumb06on"><a href="#">Answer</a></li>
</ul></div> 
<div class="assessment">
	<div class="eTitle">
		<h2><?php 
				if(	strlen($answer['Answer']['answer_text']) > 40)
					$answer['Answer']['answer_text'] = substr($answer['Answer']['answer_text'], 0, 40);
				echo $answer['Answer']['answer_text'];?>
		</h2>
	</div>
	<div class="aToolbar">
		<span class="aToolbarButton">
			<span class="iconEdit"></span>
			<a href"#">Edit Answers</a>
		</span>
		<span class="aToolbarButton">
			<span class="iconDelete"></span>
			<a href"#">Delete Answer</a>
		</span>
	</div>
	<?php
echo $ajax->form(array('type' => 'post',
    'options' => array(
		'enctype' => 'multipart/form-data',
        'model'=>'Answer',
        'update'=>'edit_div_'.$assessment['Assessment']['id'],
        'url' => array(
            'controller' => 'answers',
            'action' => 'ajax_edit'
        ),
    )
));
?>
	<div id="aForm">
	<div id="aFormLeft">

<?php echo $form->hidden('id');?>

<?php 
	
	$abbrev = '';

	if ($question['Answervalue']['abbreviation'] != ''){
		
		$abbrev = '('.$question['Answervalue']['abbreviation'].')';

	}

	$label = 'This answer is in '.$question['Answervalue']['name'].'s '.$abbrev;

	if ($question['Answervalue']['variable_type'] == 'text'){
		echo $form->input('answer_text',array('label'=>$label));
	}
	elseif ($question['Answervalue']['variable_type'] == 'decimal'){
		echo $form->input('answer_decimal', array('label'=>$label));
	}
	elseif ($question['Answervalue']['variable_type'] == 'int'){
		echo $form->input('answer_int', array('label'=>$label));
	}
	elseif ($question['Answervalue']['variable_type'] == 'file'){
		echo $form->input('answer_text',array('label'=>$label));
		#echo $form->file('answer_image');
	}

?>
	</div>
	<div id="aFormRight">

<?php echo $form->input('correct',array('label'=>'This answer is correct.'));?>
<?php 
	$show_mark_deduction = Configure::read('Settings.show_mark_deduction');
	if ($show_mark_deduction == true)
		echo $form->input('deducted_mark',array('label'=>'Points deducted.'));
?>
<?php echo $form->input('return_value');?>

			<div class="right"><div>
				<div class="submit" style="float:left;"><a href="/assessments/">Cancel</a>&nbsp;&nbsp;</div>
				<?php echo $form->end('Update'); ?>
			</div>
		</div>
	</div>
</div>